//============================================================================
// Name        : List.h
// Author      : bycy
// Version     : 1.0
// Description : 
//============================================================================

#include "ListItr.h"

template < class Type > class List:public AbsList < Type >{

	friend class ListItr< Type >;

private:

	ListNode< Type > * head;

public:

	/* 
	* Initialize an AbsListItr
	* 
	* REQUIRE:
	*	
	* RETURN:	
	*
	* NOTES:	
	*/
	
	List(){

		head = new ListNode< Type >();

	}

	/* 
	* Deconstruct an AbsListItr
	* 
	* REQUIRE:
	*	
	* RETURN:	
	*
	* NOTES:	
	*/

	~List(){
	
		MakeEmpty();

		delete head;
	
	}

	const List & operator = (const List & R);

	int isEmpty() const{
	
		return head->Next == NULL;

	}

	/* 
	* Test whether this List is full or not
	* 
	* REQUIRE:	
	*	
	* RETURN:	1 if this List is full
	*		0 if this List is not full
	*
	* NOTES:	
	*/

	int isFull() const{ return 0;}

	void MakeEmpty();

};

template < class Type > 
void List< Type > ::MakeEmpty(){

	ListNode < Type > * Ptr;
	ListNode < Type > * NextNode;

	for(Ptr = head->Nex ; Ptr != NULL ; Ptr = NextNode){
	
		NextNode = Ptr->Next;
		
		delete Ptr;

	}

	head->Next = NULL;

}